/*
 * Author: 施华锋
 * Date: 2025-01-16
 * Description: This header file defines the FTB_BT_247GN class for communicating with the FTB_BT_247GN device via SPI.
 */

#ifndef _FTB_BT_247GN_H_
#define _FTB_BT_247GN_H_

#include <driver/spi_master.h>
#include <driver/gpio.h>
#include <esp_log.h>

#define USE_MUTI_FONTS false
// uint8_t reverseBits0To6(uint8_t byte)
// {
//     uint8_t bit7 = byte & 0x80;
//     uint8_t lower6Bits = byte & 0x7F;
//     uint8_t reversedLower6Bits = 0;
//     for (int i = 0; i < 7; i++)
//     {
//         reversedLower6Bits |= ((lower6Bits >> i) & 1) << (6 - i);
//     }
//
//     return bit7 | reversedLower6Bits;
// }

// int main()
// {
//     for (int i = 0; i < CHAR_SIZE; i++)
//     {
//         printf("{");
//         printf("0x%02X", reverseBits0To6(hex_codes_style2[i][0]));
//         for (int j = 1; j < 5; j++)
//             printf(", 0x%02X", reverseBits0To6(hex_codes_style2[i][j]));
//         printf("}, ");
//         printf("/*\"%c\", %d(ASCII)*/\r\n", (char)(i + ' '), (i + ' '));
//     }
//     return 0;
// }
/**
 * @class FTB_BT_247GN
 * @brief A class for interacting with the FTB_BT_247GN device using SPI communication.
 *
 * This class provides methods to initialize the FTB_BT_247GN device, write data to it, and refresh its display.
 */
class FTB_BT_247GN
{
public:
#define PIXEL_COUNT (20)
#define NUM_COUNT (21)
#define ICON_COUNT (51)
#define CHAR_SIZE (95 + 1)
    //  Hexadecimal code corresponding to each character
    //  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz
    const uint8_t hex_codes_style1[CHAR_SIZE][5] = {
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*" ", 32(ASCII)*/
        {0x00, 0x00, 0x4F, 0x00, 0x00}, /*"!", 33(ASCII)*/
        {0x00, 0x03, 0x00, 0x03, 0x00}, /*""", 34(ASCII)*/
        {0x22, 0x7F, 0x22, 0x7F, 0x22}, /*"#", 35(ASCII)*/
        {0x24, 0x2A, 0x7F, 0x2A, 0x12}, /*"$", 36(ASCII)*/
        {0x23, 0x13, 0x08, 0x64, 0x62}, /*"%", 37(ASCII)*/
        {0x36, 0x49, 0x56, 0x20, 0x58}, /*"&", 38(ASCII)*/
        {0x00, 0x02, 0x01, 0x00, 0x00}, /*"'", 39(ASCII)*/
        {0x00, 0x1C, 0x22, 0x41, 0x00}, /*"(", 40(ASCII)*/
        {0x00, 0x41, 0x22, 0x1C, 0x00}, /*")", 41(ASCII)*/
        {0x14, 0x08, 0x3E, 0x08, 0x14}, /*"*", 42(ASCII)*/
        {0x08, 0x08, 0x3E, 0x08, 0x08}, /*"+", 43(ASCII)*/
        {0x00, 0x40, 0x20, 0x00, 0x00}, /*",", 44(ASCII)*/
        {0x08, 0x08, 0x08, 0x08, 0x08}, /*"-", 45(ASCII)*/
        {0x00, 0x40, 0x00, 0x00, 0x00}, /*".", 46(ASCII)*/
        {0x20, 0x10, 0x08, 0x04, 0x02}, /*"/", 47(ASCII)*/
        {0x3E, 0x41, 0x41, 0x41, 0x3E}, /*"0", 48(ASCII)*/
        {0x00, 0x02, 0x02, 0x7F, 0x00}, /*"1", 49(ASCII)*/
        {0x62, 0x51, 0x49, 0x49, 0x46}, /*"2", 50(ASCII)*/
        {0x22, 0x41, 0x49, 0x49, 0x36}, /*"3", 51(ASCII)*/
        {0x18, 0x14, 0x12, 0x7F, 0x10}, /*"4", 52(ASCII)*/
        {0x27, 0x45, 0x45, 0x45, 0x39}, /*"5", 53(ASCII)*/
        {0x3C, 0x4A, 0x49, 0x49, 0x30}, /*"6", 54(ASCII)*/
        {0x01, 0x01, 0x71, 0x0D, 0x03}, /*"7", 55(ASCII)*/
        {0x36, 0x49, 0x49, 0x49, 0x36}, /*"8", 56(ASCII)*/
        {0x06, 0x49, 0x49, 0x29, 0x1E}, /*"9", 57(ASCII)*/
        {0x00, 0x00, 0x44, 0x00, 0x00}, /*":", 58(ASCII)*/
        {0x00, 0x40, 0x24, 0x00, 0x00}, /*";", 59(ASCII)*/
        {0x00, 0x08, 0x14, 0x22, 0x41}, /*"<", 60(ASCII)*/
        {0x14, 0x14, 0x14, 0x14, 0x14}, /*"=", 61(ASCII)*/
        {0x41, 0x22, 0x14, 0x08, 0x00}, /*">", 62(ASCII)*/
        {0x02, 0x01, 0x51, 0x09, 0x06}, /*"?", 63(ASCII)*/
        {0x3E, 0x41, 0x19, 0x25, 0x3E}, /*"@", 64(ASCII)*/
        {0x7C, 0x12, 0x11, 0x12, 0x7C}, /*"A", 65(ASCII)*/
        {0x41, 0x7F, 0x49, 0x49, 0x36}, /*"B", 66(ASCII)*/
        {0x3E, 0x41, 0x41, 0x41, 0x22}, /*"C", 67(ASCII)*/
        {0x41, 0x7F, 0x41, 0x41, 0x3E}, /*"D", 68(ASCII)*/
        {0x7F, 0x49, 0x49, 0x49, 0x41}, /*"E", 69(ASCII)*/
        {0x7F, 0x09, 0x09, 0x09, 0x01}, /*"F", 70(ASCII)*/
        {0x3E, 0x41, 0x49, 0x49, 0x3A}, /*"G", 71(ASCII)*/
        {0x7F, 0x08, 0x08, 0x08, 0x7F}, /*"H", 72(ASCII)*/
        {0x00, 0x41, 0x7F, 0x41, 0x00}, /*"I", 73(ASCII)*/
        {0x20, 0x40, 0x41, 0x7F, 0x01}, /*"J", 74(ASCII)*/
        {0x7F, 0x08, 0x14, 0x22, 0x41}, /*"K", 75(ASCII)*/
        {0x7F, 0x40, 0x40, 0x40, 0x40}, /*"L", 76(ASCII)*/
        {0x7F, 0x02, 0x0C, 0x02, 0x7F}, /*"M", 77(ASCII)*/
        {0x7F, 0x04, 0x08, 0x10, 0x7F}, /*"N", 78(ASCII)*/
        {0x3E, 0x41, 0x41, 0x41, 0x3E}, /*"O", 79(ASCII)*/
        {0x7F, 0x09, 0x09, 0x09, 0x06}, /*"P", 80(ASCII)*/
        {0x3E, 0x41, 0x51, 0x21, 0x5E}, /*"Q", 81(ASCII)*/
        {0x7F, 0x09, 0x19, 0x29, 0x46}, /*"R", 82(ASCII)*/
        {0x26, 0x49, 0x49, 0x49, 0x32}, /*"S", 83(ASCII)*/
        {0x01, 0x01, 0x7F, 0x01, 0x01}, /*"T", 84(ASCII)*/
        {0x3F, 0x40, 0x40, 0x40, 0x3F}, /*"U", 85(ASCII)*/
        {0x0F, 0x30, 0x40, 0x30, 0x0F}, /*"V", 86(ASCII)*/
        {0x7F, 0x20, 0x18, 0x20, 0x7F}, /*"W", 87(ASCII)*/
        {0x63, 0x14, 0x08, 0x14, 0x63}, /*"X", 88(ASCII)*/
        {0x07, 0x08, 0x70, 0x08, 0x07}, /*"Y", 89(ASCII)*/
        {0x61, 0x51, 0x49, 0x45, 0x43}, /*"Z", 90(ASCII)*/
        {0x00, 0x7F, 0x41, 0x41, 0x00}, /*"[", 91(ASCII)*/
        {0x02, 0x04, 0x08, 0x10, 0x20}, /*"\", 92(ASCII)*/
        {0x00, 0x41, 0x41, 0x7F, 0x00}, /*"]", 93(ASCII)*/
        {0x00, 0x02, 0x01, 0x02, 0x00}, /*"^", 94(ASCII)*/
        {0x40, 0x40, 0x40, 0x40, 0x40}, /*"_", 95(ASCII)*/
        {0x00, 0x00, 0x01, 0x02, 0x00}, /*"`", 96(ASCII)*/
        {0x20, 0x54, 0x54, 0x54, 0x78}, /*"a", 97(ASCII)*/
        {0x7F, 0x44, 0x44, 0x44, 0x38}, /*"b", 98(ASCII)*/
        {0x38, 0x44, 0x44, 0x44, 0x44}, /*"c", 99(ASCII)*/
        {0x38, 0x44, 0x44, 0x44, 0x7F}, /*"d", 100(ASCII)*/
        {0x38, 0x54, 0x54, 0x54, 0x58}, /*"e", 101(ASCII)*/
        {0x04, 0x04, 0x7E, 0x05, 0x05}, /*"f", 102(ASCII)*/
        {0x4C, 0x52, 0x52, 0x3C, 0x02}, /*"g", 103(ASCII)*/
        {0x7F, 0x08, 0x04, 0x04, 0x78}, /*"h", 104(ASCII)*/
        {0x00, 0x44, 0x7D, 0x40, 0x00}, /*"i", 105(ASCII)*/
        {0x20, 0x40, 0x44, 0x3D, 0x00}, /*"j", 106(ASCII)*/
        {0x00, 0x7F, 0x10, 0x28, 0x44}, /*"k", 107(ASCII)*/
        {0x00, 0x41, 0x7F, 0x40, 0x00}, /*"l", 108(ASCII)*/
        {0x7C, 0x04, 0x78, 0x04, 0x78}, /*"m", 109(ASCII)*/
        {0x7C, 0x08, 0x04, 0x04, 0x78}, /*"n", 110(ASCII)*/
        {0x38, 0x44, 0x44, 0x44, 0x38}, /*"o", 111(ASCII)*/
        {0x7C, 0x24, 0x24, 0x24, 0x18}, /*"p", 112(ASCII)*/
        {0x18, 0x24, 0x24, 0x24, 0x7C}, /*"q", 113(ASCII)*/
        {0x00, 0x7C, 0x08, 0x04, 0x04}, /*"r", 114(ASCII)*/
        {0x48, 0x54, 0x54, 0x54, 0x24}, /*"s", 115(ASCII)*/
        {0x00, 0x04, 0x3F, 0x44, 0x44}, /*"t", 116(ASCII)*/
        {0x3C, 0x40, 0x40, 0x20, 0x7C}, /*"u", 117(ASCII)*/
        {0x0C, 0x30, 0x40, 0x30, 0x0C}, /*"v", 118(ASCII)*/
        {0x7C, 0x20, 0x18, 0x20, 0x7C}, /*"w", 119(ASCII)*/
        {0x44, 0x28, 0x10, 0x28, 0x44}, /*"x", 120(ASCII)*/
        {0x0C, 0x50, 0x50, 0x50, 0x3C}, /*"y", 121(ASCII)*/
        {0x44, 0x64, 0x54, 0x4C, 0x44}, /*"z", 122(ASCII)*/
        {0x00, 0x08, 0x36, 0x41, 0x00}, /*"{", 123(ASCII)*/
        {0x00, 0x00, 0x7F, 0x00, 0x00}, /*"|", 124(ASCII)*/
        {0x00, 0x41, 0x36, 0x08, 0x00}, /*"}", 125(ASCII)*/
        {0x10, 0x08, 0x18, 0x10, 0x08}, /*"~", 126(ASCII)*/
        {0x7F, 0x7F, 0x7F, 0x7F, 0x7F}, /*"", 127(ASCII)*/
    };
#if USE_MUTI_FONTS
    const uint8_t hex_codes_style2[CHAR_SIZE][5] = {
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*" ", 32(ASCII)*/
        {0x00, 0x00, 0x4F, 0x00, 0x00}, /*"!", 33(ASCII)*/
        {0x00, 0x03, 0x00, 0x03, 0x00}, /*""", 34(ASCII)*/
        {0x22, 0x7F, 0x22, 0x7F, 0x22}, /*"#", 35(ASCII)*/
        {0x24, 0x2A, 0x7F, 0x2A, 0x12}, /*"$", 36(ASCII)*/
        {0x23, 0x13, 0x08, 0x64, 0x62}, /*"%", 37(ASCII)*/
        {0x36, 0x49, 0x56, 0x20, 0x58}, /*"&", 38(ASCII)*/
        {0x00, 0x02, 0x01, 0x00, 0x00}, /*"'", 39(ASCII)*/
        {0x00, 0x1C, 0x22, 0x41, 0x00}, /*"(", 40(ASCII)*/
        {0x00, 0x41, 0x22, 0x1C, 0x00}, /*")", 41(ASCII)*/
        {0x14, 0x08, 0x3E, 0x08, 0x14}, /*"*", 42(ASCII)*/
        {0x08, 0x08, 0x3E, 0x08, 0x08}, /*"+", 43(ASCII)*/
        {0x00, 0x40, 0x20, 0x00, 0x00}, /*",", 44(ASCII)*/
        {0x08, 0x08, 0x08, 0x08, 0x08}, /*"-", 45(ASCII)*/
        {0x00, 0x40, 0x00, 0x00, 0x00}, /*".", 46(ASCII)*/
        {0x20, 0x10, 0x08, 0x04, 0x02}, /*"/", 47(ASCII)*/
        {0x3E, 0x51, 0x49, 0x45, 0x3E}, /*"0", 48(ASCII)*/
        {0x00, 0x42, 0x7F, 0x40, 0x00}, /*"1", 49(ASCII)*/
        {0x42, 0x61, 0x51, 0x49, 0x46}, /*"2", 50(ASCII)*/
        {0x21, 0x41, 0x45, 0x4B, 0x31}, /*"3", 51(ASCII)*/
        {0x18, 0x14, 0x12, 0x7F, 0x10}, /*"4", 52(ASCII)*/
        {0x27, 0x45, 0x45, 0x45, 0x39}, /*"5", 53(ASCII)*/
        {0x3C, 0x4A, 0x49, 0x49, 0x30}, /*"6", 54(ASCII)*/
        {0x01, 0x71, 0x09, 0x05, 0x03}, /*"7", 55(ASCII)*/
        {0x36, 0x49, 0x49, 0x49, 0x36}, /*"8", 56(ASCII)*/
        {0x06, 0x49, 0x49, 0x29, 0x1E}, /*"9", 57(ASCII)*/
        {0x00, 0x00, 0x24, 0x00, 0x00}, /*":", 58(ASCII)*/
        {0x00, 0x00, 0x44, 0x00, 0x00}, /*";", 59(ASCII)*/
        {0x08, 0x14, 0x22, 0x22, 0x41}, /*"<", 60(ASCII)*/
        {0x14, 0x14, 0x14, 0x14, 0x14}, /*"=", 61(ASCII)*/
        {0x41, 0x22, 0x22, 0x14, 0x08}, /*">", 62(ASCII)*/
        {0x07, 0x01, 0x51, 0x09, 0x07}, /*"?", 63(ASCII)*/
        {0x3E, 0x5D, 0x63, 0x5F, 0x61}, /*"@", 64(ASCII)*/
        {0x7C, 0x12, 0x11, 0x12, 0x7C}, /*"A", 65(ASCII)*/
        {0x41, 0x7F, 0x49, 0x49, 0x36}, /*"B", 66(ASCII)*/
        {0x3E, 0x41, 0x41, 0x41, 0x22}, /*"C", 67(ASCII)*/
        {0x41, 0x7F, 0x41, 0x41, 0x3E}, /*"D", 68(ASCII)*/
        {0x7F, 0x49, 0x49, 0x49, 0x41}, /*"E", 69(ASCII)*/
        {0x7F, 0x09, 0x09, 0x09, 0x01}, /*"F", 70(ASCII)*/
        {0x3E, 0x41, 0x49, 0x49, 0x3A}, /*"G", 71(ASCII)*/
        {0x7F, 0x08, 0x08, 0x08, 0x7F}, /*"H", 72(ASCII)*/
        {0x00, 0x41, 0x7F, 0x41, 0x00}, /*"I", 73(ASCII)*/
        {0x20, 0x40, 0x41, 0x7F, 0x01}, /*"J", 74(ASCII)*/
        {0x7F, 0x08, 0x14, 0x22, 0x41}, /*"K", 75(ASCII)*/
        {0x7F, 0x40, 0x40, 0x40, 0x40}, /*"L", 76(ASCII)*/
        {0x7F, 0x02, 0x0C, 0x02, 0x7F}, /*"M", 77(ASCII)*/
        {0x7F, 0x04, 0x08, 0x10, 0x7F}, /*"N", 78(ASCII)*/
        {0x3E, 0x41, 0x41, 0x41, 0x3E}, /*"O", 79(ASCII)*/
        {0x7F, 0x09, 0x09, 0x09, 0x06}, /*"P", 80(ASCII)*/
        {0x3E, 0x41, 0x51, 0x21, 0x5E}, /*"Q", 81(ASCII)*/
        {0x7F, 0x09, 0x19, 0x29, 0x46}, /*"R", 82(ASCII)*/
        {0x26, 0x49, 0x49, 0x49, 0x32}, /*"S", 83(ASCII)*/
        {0x01, 0x01, 0x7F, 0x01, 0x01}, /*"T", 84(ASCII)*/
        {0x3F, 0x40, 0x40, 0x40, 0x3F}, /*"U", 85(ASCII)*/
        {0x0F, 0x30, 0x40, 0x30, 0x0F}, /*"V", 86(ASCII)*/
        {0x7F, 0x20, 0x18, 0x20, 0x7F}, /*"W", 87(ASCII)*/
        {0x63, 0x14, 0x08, 0x14, 0x63}, /*"X", 88(ASCII)*/
        {0x07, 0x08, 0x70, 0x08, 0x07}, /*"Y", 89(ASCII)*/
        {0x61, 0x51, 0x49, 0x45, 0x43}, /*"Z", 90(ASCII)*/
        {0x00, 0x00, 0x7F, 0x00, 0x00}, /*"[", 91(ASCII)*/
        {0x01, 0x06, 0x08, 0x30, 0x40}, /*"\", 92(ASCII)*/
        {0x00, 0x00, 0x7F, 0x00, 0x00}, /*"]", 93(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"^", 94(ASCII)*/
        {0x08, 0x08, 0x08, 0x08, 0x08}, /*"_", 95(ASCII)*/
        {0x00, 0x01, 0x00, 0x00, 0x00}, /*"`", 96(ASCII)*/
        {0x20, 0x54, 0x54, 0x54, 0x78}, /*"a", 97(ASCII)*/
        {0x7F, 0x44, 0x44, 0x44, 0x38}, /*"b", 98(ASCII)*/
        {0x38, 0x44, 0x44, 0x44, 0x44}, /*"c", 99(ASCII)*/
        {0x38, 0x44, 0x44, 0x44, 0x7F}, /*"d", 100(ASCII)*/
        {0x38, 0x54, 0x54, 0x54, 0x58}, /*"e", 101(ASCII)*/
        {0x04, 0x04, 0x7E, 0x05, 0x05}, /*"f", 102(ASCII)*/
        {0x4C, 0x52, 0x52, 0x3C, 0x02}, /*"g", 103(ASCII)*/
        {0x7F, 0x08, 0x04, 0x04, 0x78}, /*"h", 104(ASCII)*/
        {0x00, 0x44, 0x7D, 0x40, 0x00}, /*"i", 105(ASCII)*/
        {0x20, 0x40, 0x44, 0x3D, 0x00}, /*"j", 106(ASCII)*/
        {0x00, 0x7F, 0x10, 0x28, 0x44}, /*"k", 107(ASCII)*/
        {0x00, 0x41, 0x7F, 0x40, 0x00}, /*"l", 108(ASCII)*/
        {0x7C, 0x04, 0x78, 0x04, 0x78}, /*"m", 109(ASCII)*/
        {0x7C, 0x08, 0x04, 0x04, 0x78}, /*"n", 110(ASCII)*/
        {0x38, 0x44, 0x44, 0x44, 0x38}, /*"o", 111(ASCII)*/
        {0x7C, 0x24, 0x24, 0x24, 0x18}, /*"p", 112(ASCII)*/
        {0x18, 0x24, 0x24, 0x24, 0x7C}, /*"q", 113(ASCII)*/
        {0x00, 0x7C, 0x08, 0x04, 0x04}, /*"r", 114(ASCII)*/
        {0x48, 0x54, 0x54, 0x54, 0x24}, /*"s", 115(ASCII)*/
        {0x00, 0x04, 0x3F, 0x44, 0x44}, /*"t", 116(ASCII)*/
        {0x3C, 0x40, 0x40, 0x20, 0x7C}, /*"u", 117(ASCII)*/
        {0x0C, 0x30, 0x40, 0x30, 0x0C}, /*"v", 118(ASCII)*/
        {0x7C, 0x20, 0x18, 0x20, 0x7C}, /*"w", 119(ASCII)*/
        {0x44, 0x28, 0x10, 0x28, 0x44}, /*"x", 120(ASCII)*/
        {0x0C, 0x50, 0x50, 0x50, 0x3C}, /*"y", 121(ASCII)*/
        {0x44, 0x64, 0x54, 0x4C, 0x44}, /*"z", 122(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"{", 123(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"|", 124(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"}", 125(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"~", 126(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"", 127(ASCII)*/

    };
    const uint8_t hex_codes_style3[CHAR_SIZE][5] = {
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*" ", 32(ASCII)*/
        {0x00, 0x00, 0x4F, 0x00, 0x00}, /*"!", 33(ASCII)*/
        {0x00, 0x03, 0x00, 0x03, 0x00}, /*""", 34(ASCII)*/
        {0x22, 0x7F, 0x22, 0x7F, 0x22}, /*"#", 35(ASCII)*/
        {0x24, 0x2A, 0x7F, 0x2A, 0x12}, /*"$", 36(ASCII)*/
        {0x23, 0x13, 0x08, 0x64, 0x62}, /*"%", 37(ASCII)*/
        {0x36, 0x49, 0x56, 0x20, 0x58}, /*"&", 38(ASCII)*/
        {0x00, 0x02, 0x01, 0x00, 0x00}, /*"'", 39(ASCII)*/
        {0x00, 0x1C, 0x22, 0x41, 0x00}, /*"(", 40(ASCII)*/
        {0x00, 0x41, 0x22, 0x1C, 0x00}, /*")", 41(ASCII)*/
        {0x14, 0x08, 0x3E, 0x08, 0x14}, /*"*", 42(ASCII)*/
        {0x08, 0x08, 0x3E, 0x08, 0x08}, /*"+", 43(ASCII)*/
        {0x00, 0x40, 0x20, 0x00, 0x00}, /*",", 44(ASCII)*/
        {0x08, 0x08, 0x08, 0x08, 0x08}, /*"-", 45(ASCII)*/
        {0x00, 0x40, 0x00, 0x00, 0x00}, /*".", 46(ASCII)*/
        {0x20, 0x10, 0x08, 0x04, 0x02}, /*"/", 47(ASCII)*/
        {0x3E, 0x7F, 0x41, 0x41, 0x3E}, /*"0", 48(ASCII)*/
        {0x00, 0x06, 0x7F, 0x7F, 0x00}, /*"1", 49(ASCII)*/
        {0x62, 0x73, 0x79, 0x6F, 0x66}, /*"2", 50(ASCII)*/
        {0x21, 0x61, 0x4D, 0x7F, 0x33}, /*"3", 51(ASCII)*/
        {0x1C, 0x12, 0x7F, 0x7F, 0x10}, /*"4", 52(ASCII)*/
        {0x26, 0x67, 0x45, 0x7D, 0x38}, /*"5", 53(ASCII)*/
        {0x3E, 0x7F, 0x4D, 0x7D, 0x38}, /*"6", 54(ASCII)*/
        {0x01, 0x71, 0x7F, 0x0F, 0x03}, /*"7", 55(ASCII)*/
        {0x36, 0x7F, 0xC9, 0x49, 0x36}, /*"8", 56(ASCII)*/
        {0x0E, 0x5B, 0x79, 0x7F, 0x1E}, /*"9", 57(ASCII)*/
        {0x00, 0x36, 0x36, 0x00, 0x00}, /*":", 58(ASCII)*/
        {0x00, 0x00, 0x44, 0x44, 0x00}, /*";", 59(ASCII)*/
        {0x08, 0x1C, 0x36, 0x22, 0x00}, /*"<", 60(ASCII)*/
        {0x14, 0x14, 0x14, 0x14, 0x14}, /*"=", 61(ASCII)*/
        {0x00, 0x22, 0x36, 0x1C, 0x08}, /*">", 62(ASCII)*/
        {0x02, 0x03, 0x09, 0x0F, 0x06}, /*"?", 63(ASCII)*/
        {0x3E, 0x7F, 0x5F, 0x7F, 0x3E}, /*"@", 64(ASCII)*/
        {0x7C, 0x12, 0x11, 0x12, 0x7C}, /*"A", 65(ASCII)*/
        {0x41, 0x7F, 0x49, 0x49, 0x36}, /*"B", 66(ASCII)*/
        {0x3E, 0x41, 0x41, 0x41, 0x22}, /*"C", 67(ASCII)*/
        {0x41, 0x7F, 0x41, 0x41, 0x3E}, /*"D", 68(ASCII)*/
        {0x7F, 0x49, 0x49, 0x49, 0x41}, /*"E", 69(ASCII)*/
        {0x7F, 0x09, 0x09, 0x09, 0x01}, /*"F", 70(ASCII)*/
        {0x3E, 0x41, 0x49, 0x49, 0x3A}, /*"G", 71(ASCII)*/
        {0x7F, 0x08, 0x08, 0x08, 0x7F}, /*"H", 72(ASCII)*/
        {0x00, 0x41, 0x7F, 0x41, 0x00}, /*"I", 73(ASCII)*/
        {0x20, 0x40, 0x41, 0x7F, 0x01}, /*"J", 74(ASCII)*/
        {0x7F, 0x08, 0x14, 0x22, 0x41}, /*"K", 75(ASCII)*/
        {0x7F, 0x40, 0x40, 0x40, 0x40}, /*"L", 76(ASCII)*/
        {0x7F, 0x02, 0x0C, 0x02, 0x7F}, /*"M", 77(ASCII)*/
        {0x7F, 0x04, 0x08, 0x10, 0x7F}, /*"N", 78(ASCII)*/
        {0x3E, 0x41, 0x41, 0x41, 0x3E}, /*"O", 79(ASCII)*/
        {0x7F, 0x09, 0x09, 0x09, 0x06}, /*"P", 80(ASCII)*/
        {0x3E, 0x41, 0x51, 0x21, 0x5E}, /*"Q", 81(ASCII)*/
        {0x7F, 0x09, 0x19, 0x29, 0x46}, /*"R", 82(ASCII)*/
        {0x26, 0x49, 0x49, 0x49, 0x32}, /*"S", 83(ASCII)*/
        {0x01, 0x01, 0x7F, 0x01, 0x01}, /*"T", 84(ASCII)*/
        {0x3F, 0x40, 0x40, 0x40, 0x3F}, /*"U", 85(ASCII)*/
        {0x0F, 0x30, 0x40, 0x30, 0x0F}, /*"V", 86(ASCII)*/
        {0x7F, 0x20, 0x18, 0x20, 0x7F}, /*"W", 87(ASCII)*/
        {0x63, 0x14, 0x08, 0x14, 0x63}, /*"X", 88(ASCII)*/
        {0x07, 0x08, 0x70, 0x08, 0x07}, /*"Y", 89(ASCII)*/
        {0x61, 0x51, 0x49, 0x45, 0x43}, /*"Z", 90(ASCII)*/
        {0x00, 0x00, 0x7F, 0x7F, 0x00}, /*"[", 91(ASCII)*/
        {0x00, 0x0E, 0x7E, 0x70, 0x00}, /*"\", 92(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"]", 93(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"^", 94(ASCII)*/
        {0x08, 0x08, 0x08, 0x08, 0x08}, /*"_", 95(ASCII)*/
        {0x00, 0x01, 0x01, 0x00, 0x00}, /*"`", 96(ASCII)*/
        {0x20, 0x54, 0x54, 0x54, 0x78}, /*"a", 97(ASCII)*/
        {0x7F, 0x44, 0x44, 0x44, 0x38}, /*"b", 98(ASCII)*/
        {0x38, 0x44, 0x44, 0x44, 0x44}, /*"c", 99(ASCII)*/
        {0x38, 0x44, 0x44, 0x44, 0x7F}, /*"d", 100(ASCII)*/
        {0x38, 0x54, 0x54, 0x54, 0x58}, /*"e", 101(ASCII)*/
        {0x04, 0x04, 0x7E, 0x05, 0x05}, /*"f", 102(ASCII)*/
        {0x4C, 0x52, 0x52, 0x3C, 0x02}, /*"g", 103(ASCII)*/
        {0x7F, 0x08, 0x04, 0x04, 0x78}, /*"h", 104(ASCII)*/
        {0x00, 0x44, 0x7D, 0x40, 0x00}, /*"i", 105(ASCII)*/
        {0x20, 0x40, 0x44, 0x3D, 0x00}, /*"j", 106(ASCII)*/
        {0x00, 0x7F, 0x10, 0x28, 0x44}, /*"k", 107(ASCII)*/
        {0x00, 0x41, 0x7F, 0x40, 0x00}, /*"l", 108(ASCII)*/
        {0x7C, 0x04, 0x78, 0x04, 0x78}, /*"m", 109(ASCII)*/
        {0x7C, 0x08, 0x04, 0x04, 0x78}, /*"n", 110(ASCII)*/
        {0x38, 0x44, 0x44, 0x44, 0x38}, /*"o", 111(ASCII)*/
        {0x7C, 0x24, 0x24, 0x24, 0x18}, /*"p", 112(ASCII)*/
        {0x18, 0x24, 0x24, 0x24, 0x7C}, /*"q", 113(ASCII)*/
        {0x00, 0x7C, 0x08, 0x04, 0x04}, /*"r", 114(ASCII)*/
        {0x48, 0x54, 0x54, 0x54, 0x24}, /*"s", 115(ASCII)*/
        {0x00, 0x04, 0x3F, 0x44, 0x44}, /*"t", 116(ASCII)*/
        {0x3C, 0x40, 0x40, 0x20, 0x7C}, /*"u", 117(ASCII)*/
        {0x0C, 0x30, 0x40, 0x30, 0x0C}, /*"v", 118(ASCII)*/
        {0x7C, 0x20, 0x18, 0x20, 0x7C}, /*"w", 119(ASCII)*/
        {0x44, 0x28, 0x10, 0x28, 0x44}, /*"x", 120(ASCII)*/
        {0x0C, 0x50, 0x50, 0x50, 0x3C}, /*"y", 121(ASCII)*/
        {0x44, 0x64, 0x54, 0x4C, 0x44}, /*"z", 122(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"{", 123(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"|", 124(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"}", 125(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"~", 126(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"", 127(ASCII)*/

    };
    const uint8_t hex_codes_style4[CHAR_SIZE][5] = {
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*" ", 32(ASCII)*/
        {0x00, 0x00, 0x4F, 0x00, 0x00}, /*"!", 33(ASCII)*/
        {0x00, 0x03, 0x00, 0x03, 0x00}, /*""", 34(ASCII)*/
        {0x22, 0x7F, 0x22, 0x7F, 0x22}, /*"#", 35(ASCII)*/
        {0x24, 0x2A, 0x7F, 0x2A, 0x12}, /*"$", 36(ASCII)*/
        {0x23, 0x13, 0x08, 0x64, 0x62}, /*"%", 37(ASCII)*/
        {0x36, 0x49, 0x56, 0x20, 0x58}, /*"&", 38(ASCII)*/
        {0x00, 0x02, 0x01, 0x00, 0x00}, /*"'", 39(ASCII)*/
        {0x00, 0x1C, 0x22, 0x41, 0x00}, /*"(", 40(ASCII)*/
        {0x00, 0x41, 0x22, 0x1C, 0x00}, /*")", 41(ASCII)*/
        {0x14, 0x08, 0x3E, 0x08, 0x14}, /*"*", 42(ASCII)*/
        {0x08, 0x08, 0x3E, 0x08, 0x08}, /*"+", 43(ASCII)*/
        {0x00, 0x40, 0x20, 0x00, 0x00}, /*",", 44(ASCII)*/
        {0x08, 0x08, 0x08, 0x08, 0x08}, /*"-", 45(ASCII)*/
        {0x00, 0x40, 0x00, 0x00, 0x00}, /*".", 46(ASCII)*/
        {0x20, 0x10, 0x08, 0x04, 0x02}, /*"/", 47(ASCII)*/
        {0x7F, 0x41, 0x41, 0x7F, 0x7F}, /*"0", 48(ASCII)*/
        {0x00, 0x00, 0x7F, 0x7F, 0x00}, /*"1", 49(ASCII)*/
        {0x79, 0x79, 0x49, 0x49, 0x4F}, /*"2", 50(ASCII)*/
        {0x41, 0x49, 0x49, 0x7F, 0x7F}, /*"3", 51(ASCII)*/
        {0x0E, 0x08, 0x08, 0x7F, 0x7F}, /*"4", 52(ASCII)*/
        {0x4F, 0x49, 0x49, 0x79, 0x79}, /*"5", 53(ASCII)*/
        {0x7F, 0x49, 0x49, 0x79, 0x78}, /*"6", 54(ASCII)*/
        {0x01, 0x01, 0x01, 0x7F, 0x7F}, /*"7", 55(ASCII)*/
        {0x7F, 0x49, 0x49, 0x7F, 0x7F}, /*"8", 56(ASCII)*/
        {0x0F, 0x49, 0x49, 0x7F, 0x7F}, /*"9", 57(ASCII)*/
        {0x00, 0x36, 0x36, 0x00, 0x00}, /*":", 58(ASCII)*/
        {0x00, 0x00, 0x44, 0x44, 0x00}, /*";", 59(ASCII)*/
        {0x08, 0x1C, 0x36, 0x22, 0x00}, /*"<", 60(ASCII)*/
        {0x14, 0x14, 0x14, 0x14, 0x14}, /*"=", 61(ASCII)*/
        {0x00, 0x22, 0x36, 0x1C, 0x08}, /*">", 62(ASCII)*/
        {0x02, 0x03, 0x09, 0x0F, 0x06}, /*"?", 63(ASCII)*/
        {0x3E, 0x7F, 0x5F, 0x7F, 0x3E}, /*"@", 64(ASCII)*/
        {0x7C, 0x12, 0x11, 0x12, 0x7C}, /*"A", 65(ASCII)*/
        {0x41, 0x7F, 0x49, 0x49, 0x36}, /*"B", 66(ASCII)*/
        {0x3E, 0x41, 0x41, 0x41, 0x22}, /*"C", 67(ASCII)*/
        {0x41, 0x7F, 0x41, 0x41, 0x3E}, /*"D", 68(ASCII)*/
        {0x7F, 0x49, 0x49, 0x49, 0x41}, /*"E", 69(ASCII)*/
        {0x7F, 0x09, 0x09, 0x09, 0x01}, /*"F", 70(ASCII)*/
        {0x3E, 0x41, 0x49, 0x49, 0x3A}, /*"G", 71(ASCII)*/
        {0x7F, 0x08, 0x08, 0x08, 0x7F}, /*"H", 72(ASCII)*/
        {0x00, 0x41, 0x7F, 0x41, 0x00}, /*"I", 73(ASCII)*/
        {0x20, 0x40, 0x41, 0x7F, 0x01}, /*"J", 74(ASCII)*/
        {0x7F, 0x08, 0x14, 0x22, 0x41}, /*"K", 75(ASCII)*/
        {0x7F, 0x40, 0x40, 0x40, 0x40}, /*"L", 76(ASCII)*/
        {0x7F, 0x02, 0x0C, 0x02, 0x7F}, /*"M", 77(ASCII)*/
        {0x7F, 0x04, 0x08, 0x10, 0x7F}, /*"N", 78(ASCII)*/
        {0x3E, 0x41, 0x41, 0x41, 0x3E}, /*"O", 79(ASCII)*/
        {0x7F, 0x09, 0x09, 0x09, 0x06}, /*"P", 80(ASCII)*/
        {0x3E, 0x41, 0x51, 0x21, 0x5E}, /*"Q", 81(ASCII)*/
        {0x7F, 0x09, 0x19, 0x29, 0x46}, /*"R", 82(ASCII)*/
        {0x26, 0x49, 0x49, 0x49, 0x32}, /*"S", 83(ASCII)*/
        {0x01, 0x01, 0x7F, 0x01, 0x01}, /*"T", 84(ASCII)*/
        {0x3F, 0x40, 0x40, 0x40, 0x3F}, /*"U", 85(ASCII)*/
        {0x0F, 0x30, 0x40, 0x30, 0x0F}, /*"V", 86(ASCII)*/
        {0x7F, 0x20, 0x18, 0x20, 0x7F}, /*"W", 87(ASCII)*/
        {0x63, 0x14, 0x08, 0x14, 0x63}, /*"X", 88(ASCII)*/
        {0x07, 0x08, 0x70, 0x08, 0x07}, /*"Y", 89(ASCII)*/
        {0x61, 0x51, 0x49, 0x45, 0x43}, /*"Z", 90(ASCII)*/
        {0x00, 0x00, 0x7F, 0x7F, 0x00}, /*"[", 91(ASCII)*/
        {0x00, 0x0E, 0x7E, 0x70, 0x00}, /*"\", 92(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"]", 93(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"^", 94(ASCII)*/
        {0x08, 0x08, 0x08, 0x08, 0x08}, /*"_", 95(ASCII)*/
        {0x00, 0x01, 0x01, 0x00, 0x00}, /*"`", 96(ASCII)*/
        {0x20, 0x54, 0x54, 0x54, 0x78}, /*"a", 97(ASCII)*/
        {0x7F, 0x44, 0x44, 0x44, 0x38}, /*"b", 98(ASCII)*/
        {0x38, 0x44, 0x44, 0x44, 0x44}, /*"c", 99(ASCII)*/
        {0x38, 0x44, 0x44, 0x44, 0x7F}, /*"d", 100(ASCII)*/
        {0x38, 0x54, 0x54, 0x54, 0x58}, /*"e", 101(ASCII)*/
        {0x04, 0x04, 0x7E, 0x05, 0x05}, /*"f", 102(ASCII)*/
        {0x4C, 0x52, 0x52, 0x3C, 0x02}, /*"g", 103(ASCII)*/
        {0x7F, 0x08, 0x04, 0x04, 0x78}, /*"h", 104(ASCII)*/
        {0x00, 0x44, 0x7D, 0x40, 0x00}, /*"i", 105(ASCII)*/
        {0x20, 0x40, 0x44, 0x3D, 0x00}, /*"j", 106(ASCII)*/
        {0x00, 0x7F, 0x10, 0x28, 0x44}, /*"k", 107(ASCII)*/
        {0x00, 0x41, 0x7F, 0x40, 0x00}, /*"l", 108(ASCII)*/
        {0x7C, 0x04, 0x78, 0x04, 0x78}, /*"m", 109(ASCII)*/
        {0x7C, 0x08, 0x04, 0x04, 0x78}, /*"n", 110(ASCII)*/
        {0x38, 0x44, 0x44, 0x44, 0x38}, /*"o", 111(ASCII)*/
        {0x7C, 0x24, 0x24, 0x24, 0x18}, /*"p", 112(ASCII)*/
        {0x18, 0x24, 0x24, 0x24, 0x7C}, /*"q", 113(ASCII)*/
        {0x00, 0x7C, 0x08, 0x04, 0x04}, /*"r", 114(ASCII)*/
        {0x48, 0x54, 0x54, 0x54, 0x24}, /*"s", 115(ASCII)*/
        {0x00, 0x04, 0x3F, 0x44, 0x44}, /*"t", 116(ASCII)*/
        {0x3C, 0x40, 0x40, 0x20, 0x7C}, /*"u", 117(ASCII)*/
        {0x0C, 0x30, 0x40, 0x30, 0x0C}, /*"v", 118(ASCII)*/
        {0x7C, 0x20, 0x18, 0x20, 0x7C}, /*"w", 119(ASCII)*/
        {0x44, 0x28, 0x10, 0x28, 0x44}, /*"x", 120(ASCII)*/
        {0x0C, 0x50, 0x50, 0x50, 0x3C}, /*"y", 121(ASCII)*/
        {0x44, 0x64, 0x54, 0x4C, 0x44}, /*"z", 122(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"{", 123(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"|", 124(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"}", 125(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"~", 126(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"", 127(ASCII)*/

    };
    const uint8_t hex_codes_style5[CHAR_SIZE][5] = {
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*" ", 32(ASCII)*/
        {0x00, 0x00, 0x4F, 0x00, 0x00}, /*"!", 33(ASCII)*/
        {0x00, 0x03, 0x00, 0x03, 0x00}, /*""", 34(ASCII)*/
        {0x22, 0x7F, 0x22, 0x7F, 0x22}, /*"#", 35(ASCII)*/
        {0x24, 0x2A, 0x7F, 0x2A, 0x12}, /*"$", 36(ASCII)*/
        {0x23, 0x13, 0x08, 0x64, 0x62}, /*"%", 37(ASCII)*/
        {0x36, 0x49, 0x56, 0x20, 0x58}, /*"&", 38(ASCII)*/
        {0x00, 0x02, 0x01, 0x00, 0x00}, /*"'", 39(ASCII)*/
        {0x00, 0x1C, 0x22, 0x41, 0x00}, /*"(", 40(ASCII)*/
        {0x00, 0x41, 0x22, 0x1C, 0x00}, /*")", 41(ASCII)*/
        {0x14, 0x08, 0x3E, 0x08, 0x14}, /*"*", 42(ASCII)*/
        {0x08, 0x08, 0x3E, 0x08, 0x08}, /*"+", 43(ASCII)*/
        {0x00, 0x40, 0x20, 0x00, 0x00}, /*",", 44(ASCII)*/
        {0x08, 0x08, 0x08, 0x08, 0x08}, /*"-", 45(ASCII)*/
        {0x00, 0x40, 0x00, 0x00, 0x00}, /*".", 46(ASCII)*/
        {0x20, 0x10, 0x08, 0x04, 0x02}, /*"/", 47(ASCII)*/
        {0x7F, 0x7F, 0x41, 0x7F, 0x7F}, /*"0", 48(ASCII)*/
        {0x00, 0x06, 0x7F, 0x7F, 0x00}, /*"1", 49(ASCII)*/
        {0x79, 0x79, 0x49, 0x4F, 0x4F}, /*"2", 50(ASCII)*/
        {0x49, 0x49, 0x49, 0x7F, 0x7F}, /*"3", 51(ASCII)*/
        {0x0F, 0x0F, 0x08, 0x7F, 0x7F}, /*"4", 52(ASCII)*/
        {0x4F, 0x4F, 0x49, 0x79, 0x79}, /*"5", 53(ASCII)*/
        {0x7F, 0x7F, 0x49, 0x79, 0x78}, /*"6", 54(ASCII)*/
        {0x01, 0x01, 0x71, 0x7F, 0x0F}, /*"7", 55(ASCII)*/
        {0x7F, 0x7F, 0x49, 0x7F, 0x7F}, /*"8", 56(ASCII)*/
        {0x0F, 0x4F, 0x49, 0x7F, 0x7F}, /*"9", 57(ASCII)*/
        {0x00, 0x36, 0x36, 0x00, 0x00}, /*":", 58(ASCII)*/
        {0x00, 0x00, 0x44, 0x44, 0x00}, /*";", 59(ASCII)*/
        {0x08, 0x1C, 0x36, 0x22, 0x00}, /*"<", 60(ASCII)*/
        {0x14, 0x14, 0x14, 0x14, 0x14}, /*"=", 61(ASCII)*/
        {0x00, 0x22, 0x36, 0x1C, 0x08}, /*">", 62(ASCII)*/
        {0x02, 0x03, 0x09, 0x0F, 0x06}, /*"?", 63(ASCII)*/
        {0x3E, 0x7F, 0x5F, 0x7F, 0x3E}, /*"@", 64(ASCII)*/
        {0x7C, 0x12, 0x11, 0x12, 0x7C}, /*"A", 65(ASCII)*/
        {0x41, 0x7F, 0x49, 0x49, 0x36}, /*"B", 66(ASCII)*/
        {0x3E, 0x41, 0x41, 0x41, 0x22}, /*"C", 67(ASCII)*/
        {0x41, 0x7F, 0x41, 0x41, 0x3E}, /*"D", 68(ASCII)*/
        {0x7F, 0x49, 0x49, 0x49, 0x41}, /*"E", 69(ASCII)*/
        {0x7F, 0x09, 0x09, 0x09, 0x01}, /*"F", 70(ASCII)*/
        {0x3E, 0x41, 0x49, 0x49, 0x3A}, /*"G", 71(ASCII)*/
        {0x7F, 0x08, 0x08, 0x08, 0x7F}, /*"H", 72(ASCII)*/
        {0x00, 0x41, 0x7F, 0x41, 0x00}, /*"I", 73(ASCII)*/
        {0x20, 0x40, 0x41, 0x7F, 0x01}, /*"J", 74(ASCII)*/
        {0x7F, 0x08, 0x14, 0x22, 0x41}, /*"K", 75(ASCII)*/
        {0x7F, 0x40, 0x40, 0x40, 0x40}, /*"L", 76(ASCII)*/
        {0x7F, 0x02, 0x0C, 0x02, 0x7F}, /*"M", 77(ASCII)*/
        {0x7F, 0x04, 0x08, 0x10, 0x7F}, /*"N", 78(ASCII)*/
        {0x3E, 0x41, 0x41, 0x41, 0x3E}, /*"O", 79(ASCII)*/
        {0x7F, 0x09, 0x09, 0x09, 0x06}, /*"P", 80(ASCII)*/
        {0x3E, 0x41, 0x51, 0x21, 0x5E}, /*"Q", 81(ASCII)*/
        {0x7F, 0x09, 0x19, 0x29, 0x46}, /*"R", 82(ASCII)*/
        {0x26, 0x49, 0x49, 0x49, 0x32}, /*"S", 83(ASCII)*/
        {0x01, 0x01, 0x7F, 0x01, 0x01}, /*"T", 84(ASCII)*/
        {0x3F, 0x40, 0x40, 0x40, 0x3F}, /*"U", 85(ASCII)*/
        {0x0F, 0x30, 0x40, 0x30, 0x0F}, /*"V", 86(ASCII)*/
        {0x7F, 0x20, 0x18, 0x20, 0x7F}, /*"W", 87(ASCII)*/
        {0x63, 0x14, 0x08, 0x14, 0x63}, /*"X", 88(ASCII)*/
        {0x07, 0x08, 0x70, 0x08, 0x07}, /*"Y", 89(ASCII)*/
        {0x61, 0x51, 0x49, 0x45, 0x43}, /*"Z", 90(ASCII)*/
        {0x00, 0x00, 0x7F, 0x7F, 0x00}, /*"[", 91(ASCII)*/
        {0x00, 0x0E, 0x7E, 0x70, 0x00}, /*"\", 92(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"]", 93(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"^", 94(ASCII)*/
        {0x08, 0x08, 0x08, 0x08, 0x08}, /*"_", 95(ASCII)*/
        {0x00, 0x01, 0x01, 0x00, 0x00}, /*"`", 96(ASCII)*/
        {0x20, 0x54, 0x54, 0x54, 0x78}, /*"a", 97(ASCII)*/
        {0x7F, 0x44, 0x44, 0x44, 0x38}, /*"b", 98(ASCII)*/
        {0x38, 0x44, 0x44, 0x44, 0x44}, /*"c", 99(ASCII)*/
        {0x38, 0x44, 0x44, 0x44, 0x7F}, /*"d", 100(ASCII)*/
        {0x38, 0x54, 0x54, 0x54, 0x58}, /*"e", 101(ASCII)*/
        {0x04, 0x04, 0x7E, 0x05, 0x05}, /*"f", 102(ASCII)*/
        {0x4C, 0x52, 0x52, 0x3C, 0x02}, /*"g", 103(ASCII)*/
        {0x7F, 0x08, 0x04, 0x04, 0x78}, /*"h", 104(ASCII)*/
        {0x00, 0x44, 0x7D, 0x40, 0x00}, /*"i", 105(ASCII)*/
        {0x20, 0x40, 0x44, 0x3D, 0x00}, /*"j", 106(ASCII)*/
        {0x00, 0x7F, 0x10, 0x28, 0x44}, /*"k", 107(ASCII)*/
        {0x00, 0x41, 0x7F, 0x40, 0x00}, /*"l", 108(ASCII)*/
        {0x7C, 0x04, 0x78, 0x04, 0x78}, /*"m", 109(ASCII)*/
        {0x7C, 0x08, 0x04, 0x04, 0x78}, /*"n", 110(ASCII)*/
        {0x38, 0x44, 0x44, 0x44, 0x38}, /*"o", 111(ASCII)*/
        {0x7C, 0x24, 0x24, 0x24, 0x18}, /*"p", 112(ASCII)*/
        {0x18, 0x24, 0x24, 0x24, 0x7C}, /*"q", 113(ASCII)*/
        {0x00, 0x7C, 0x08, 0x04, 0x04}, /*"r", 114(ASCII)*/
        {0x48, 0x54, 0x54, 0x54, 0x24}, /*"s", 115(ASCII)*/
        {0x00, 0x04, 0x3F, 0x44, 0x44}, /*"t", 116(ASCII)*/
        {0x3C, 0x40, 0x40, 0x20, 0x7C}, /*"u", 117(ASCII)*/
        {0x0C, 0x30, 0x40, 0x30, 0x0C}, /*"v", 118(ASCII)*/
        {0x7C, 0x20, 0x18, 0x20, 0x7C}, /*"w", 119(ASCII)*/
        {0x44, 0x28, 0x10, 0x28, 0x44}, /*"x", 120(ASCII)*/
        {0x0C, 0x50, 0x50, 0x50, 0x3C}, /*"y", 121(ASCII)*/
        {0x44, 0x64, 0x54, 0x4C, 0x44}, /*"z", 122(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"{", 123(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"|", 124(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"}", 125(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"~", 126(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"", 127(ASCII)*/

    };
    const uint8_t hex_codes_style6[CHAR_SIZE][5] = {
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*" ", 32(ASCII)*/
        {0x00, 0x00, 0x4F, 0x00, 0x00}, /*"!", 33(ASCII)*/
        {0x00, 0x03, 0x00, 0x03, 0x00}, /*""", 34(ASCII)*/
        {0x22, 0x7F, 0x22, 0x7F, 0x22}, /*"#", 35(ASCII)*/
        {0x24, 0x2A, 0x7F, 0x2A, 0x12}, /*"$", 36(ASCII)*/
        {0x23, 0x13, 0x08, 0x64, 0x62}, /*"%", 37(ASCII)*/
        {0x36, 0x49, 0x56, 0x20, 0x58}, /*"&", 38(ASCII)*/
        {0x00, 0x02, 0x01, 0x00, 0x00}, /*"'", 39(ASCII)*/
        {0x00, 0x1C, 0x22, 0x41, 0x00}, /*"(", 40(ASCII)*/
        {0x00, 0x41, 0x22, 0x1C, 0x00}, /*")", 41(ASCII)*/
        {0x14, 0x08, 0x3E, 0x08, 0x14}, /*"*", 42(ASCII)*/
        {0x08, 0x08, 0x3E, 0x08, 0x08}, /*"+", 43(ASCII)*/
        {0x00, 0x40, 0x20, 0x00, 0x00}, /*",", 44(ASCII)*/
        {0x08, 0x08, 0x08, 0x08, 0x08}, /*"-", 45(ASCII)*/
        {0x00, 0x40, 0x00, 0x00, 0x00}, /*".", 46(ASCII)*/
        {0x20, 0x10, 0x08, 0x04, 0x02}, /*"/", 47(ASCII)*/
        {0x70, 0x5F, 0x41, 0x5F, 0x70}, /*"0", 48(ASCII)*/
        {0x40, 0x41, 0x7F, 0x40, 0x70}, /*"1", 49(ASCII)*/
        {0x71, 0x51, 0x51, 0x51, 0x5F}, /*"2", 50(ASCII)*/
        {0x40, 0x41, 0x51, 0x51, 0x7F}, /*"3", 51(ASCII)*/
        {0x1F, 0x10, 0x10, 0x10, 0x7E}, /*"4", 52(ASCII)*/
        {0x5F, 0x51, 0x51, 0x51, 0x70}, /*"5", 53(ASCII)*/
        {0x7F, 0x51, 0x51, 0x50, 0x70}, /*"6", 54(ASCII)*/
        {0x01, 0x01, 0x61, 0x11, 0x0F}, /*"7", 55(ASCII)*/
        {0x70, 0x5F, 0x51, 0x5F, 0x70}, /*"8", 56(ASCII)*/
        {0x1F, 0x11, 0x51, 0x51, 0x7F}, /*"9", 57(ASCII)*/
        {0x00, 0x36, 0x36, 0x00, 0x00}, /*":", 58(ASCII)*/
        {0x00, 0x00, 0x44, 0x44, 0x00}, /*";", 59(ASCII)*/
        {0x08, 0x1C, 0x36, 0x22, 0x00}, /*"<", 60(ASCII)*/
        {0x14, 0x14, 0x14, 0x14, 0x14}, /*"=", 61(ASCII)*/
        {0x00, 0x22, 0x36, 0x1C, 0x08}, /*">", 62(ASCII)*/
        {0x02, 0x03, 0x09, 0x0F, 0x06}, /*"?", 63(ASCII)*/
        {0x3E, 0x7F, 0x5F, 0x7F, 0x3E}, /*"@", 64(ASCII)*/
        {0x7C, 0x12, 0x11, 0x12, 0x7C}, /*"A", 65(ASCII)*/
        {0x41, 0x7F, 0x49, 0x49, 0x36}, /*"B", 66(ASCII)*/
        {0x3E, 0x41, 0x41, 0x41, 0x22}, /*"C", 67(ASCII)*/
        {0x41, 0x7F, 0x41, 0x41, 0x3E}, /*"D", 68(ASCII)*/
        {0x7F, 0x49, 0x49, 0x49, 0x41}, /*"E", 69(ASCII)*/
        {0x7F, 0x09, 0x09, 0x09, 0x01}, /*"F", 70(ASCII)*/
        {0x3E, 0x41, 0x49, 0x49, 0x3A}, /*"G", 71(ASCII)*/
        {0x7F, 0x08, 0x08, 0x08, 0x7F}, /*"H", 72(ASCII)*/
        {0x00, 0x41, 0x7F, 0x41, 0x00}, /*"I", 73(ASCII)*/
        {0x20, 0x40, 0x41, 0x7F, 0x01}, /*"J", 74(ASCII)*/
        {0x7F, 0x08, 0x14, 0x22, 0x41}, /*"K", 75(ASCII)*/
        {0x7F, 0x40, 0x40, 0x40, 0x40}, /*"L", 76(ASCII)*/
        {0x7F, 0x02, 0x0C, 0x02, 0x7F}, /*"M", 77(ASCII)*/
        {0x7F, 0x04, 0x08, 0x10, 0x7F}, /*"N", 78(ASCII)*/
        {0x3E, 0x41, 0x41, 0x41, 0x3E}, /*"O", 79(ASCII)*/
        {0x7F, 0x09, 0x09, 0x09, 0x06}, /*"P", 80(ASCII)*/
        {0x3E, 0x41, 0x51, 0x21, 0x5E}, /*"Q", 81(ASCII)*/
        {0x7F, 0x09, 0x19, 0x29, 0x46}, /*"R", 82(ASCII)*/
        {0x26, 0x49, 0x49, 0x49, 0x32}, /*"S", 83(ASCII)*/
        {0x01, 0x01, 0x7F, 0x01, 0x01}, /*"T", 84(ASCII)*/
        {0x3F, 0x40, 0x40, 0x40, 0x3F}, /*"U", 85(ASCII)*/
        {0x0F, 0x30, 0x40, 0x30, 0x0F}, /*"V", 86(ASCII)*/
        {0x7F, 0x20, 0x18, 0x20, 0x7F}, /*"W", 87(ASCII)*/
        {0x63, 0x14, 0x08, 0x14, 0x63}, /*"X", 88(ASCII)*/
        {0x07, 0x08, 0x70, 0x08, 0x07}, /*"Y", 89(ASCII)*/
        {0x61, 0x51, 0x49, 0x45, 0x43}, /*"Z", 90(ASCII)*/
        {0x00, 0x00, 0x7F, 0x7F, 0x00}, /*"[", 91(ASCII)*/
        {0x00, 0x0E, 0x7E, 0x70, 0x00}, /*"\", 92(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"]", 93(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"^", 94(ASCII)*/
        {0x08, 0x08, 0x08, 0x08, 0x08}, /*"_", 95(ASCII)*/
        {0x00, 0x01, 0x01, 0x00, 0x00}, /*"`", 96(ASCII)*/
        {0x20, 0x54, 0x54, 0x54, 0x78}, /*"a", 97(ASCII)*/
        {0x7F, 0x44, 0x44, 0x44, 0x38}, /*"b", 98(ASCII)*/
        {0x38, 0x44, 0x44, 0x44, 0x44}, /*"c", 99(ASCII)*/
        {0x38, 0x44, 0x44, 0x44, 0x7F}, /*"d", 100(ASCII)*/
        {0x38, 0x54, 0x54, 0x54, 0x58}, /*"e", 101(ASCII)*/
        {0x04, 0x04, 0x7E, 0x05, 0x05}, /*"f", 102(ASCII)*/
        {0x4C, 0x52, 0x52, 0x3C, 0x02}, /*"g", 103(ASCII)*/
        {0x7F, 0x08, 0x04, 0x04, 0x78}, /*"h", 104(ASCII)*/
        {0x00, 0x44, 0x7D, 0x40, 0x00}, /*"i", 105(ASCII)*/
        {0x20, 0x40, 0x44, 0x3D, 0x00}, /*"j", 106(ASCII)*/
        {0x00, 0x7F, 0x10, 0x28, 0x44}, /*"k", 107(ASCII)*/
        {0x00, 0x41, 0x7F, 0x40, 0x00}, /*"l", 108(ASCII)*/
        {0x7C, 0x04, 0x78, 0x04, 0x78}, /*"m", 109(ASCII)*/
        {0x7C, 0x08, 0x04, 0x04, 0x78}, /*"n", 110(ASCII)*/
        {0x38, 0x44, 0x44, 0x44, 0x38}, /*"o", 111(ASCII)*/
        {0x7C, 0x24, 0x24, 0x24, 0x18}, /*"p", 112(ASCII)*/
        {0x18, 0x24, 0x24, 0x24, 0x7C}, /*"q", 113(ASCII)*/
        {0x00, 0x7C, 0x08, 0x04, 0x04}, /*"r", 114(ASCII)*/
        {0x48, 0x54, 0x54, 0x54, 0x24}, /*"s", 115(ASCII)*/
        {0x00, 0x04, 0x3F, 0x44, 0x44}, /*"t", 116(ASCII)*/
        {0x3C, 0x40, 0x40, 0x20, 0x7C}, /*"u", 117(ASCII)*/
        {0x0C, 0x30, 0x40, 0x30, 0x0C}, /*"v", 118(ASCII)*/
        {0x7C, 0x20, 0x18, 0x20, 0x7C}, /*"w", 119(ASCII)*/
        {0x44, 0x28, 0x10, 0x28, 0x44}, /*"x", 120(ASCII)*/
        {0x0C, 0x50, 0x50, 0x50, 0x3C}, /*"y", 121(ASCII)*/
        {0x44, 0x64, 0x54, 0x4C, 0x44}, /*"z", 122(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"{", 123(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"|", 124(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"}", 125(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"~", 126(ASCII)*/
        {0x00, 0x00, 0x00, 0x00, 0x00}, /*"", 127(ASCII)*/

    };
#endif
    // Hexadecimal code corresponding to each character
    // !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz
    const uint8_t num_hex_codes[CHAR_SIZE] = {
        0,
        0,    // !
        0,    // "
        0,    // #
        0,    // $
        0,    // %
        0,    // &
        0,    // '
        0,    // (
        0,    // )
        0x61, // *
        0,    // +
        0,    // ,
        0,    // -
        0,    // .
        0,    // /
        0x3f, // 0
        0x06, // 1
        0x5b, // 2
        0x4f, // 3
        0x66, // 4
        0x6d, // 5
        0x7d, // 6
        0x07, // 7
        0x7f, // 8
        0x6f, // 9
        0,    // :
        0,    // ;
        0,    // <
        0,    // =
        0,    // >
        0,    // ?
        0,    // @
        0x77, // A
        0x7c, // B
        0x39, // C
        0x5e, // D
        0x79, // E
        0x71, // F
        0x6f, // G
        0x76, // H
        0x06, // I
        0x0e, // J
        0x74, // K
        0x38, // L
        0x36, // M
        0x54, // N
        0x3f, // O
        0x73, // P
        0x67, // Q
        0x50, // R
        0x6d, // S
        0x78, // T
        0x3e, // U
        0x3e, // V
        0x36, // W
        0x76, // X
        0x6e, // Y
        0x5b  // Z
    };
    typedef enum
    {
        Play,
        Pause,
        Cue,
        Hand,
        Acue,
        Reloop,
        Single,
        Folder,
        Mp3,
        Wma,
        Aac,
        All,
        Track,

        F,
        S,
        Colon,
        M,
        Bar_10,
        Bar_9,
        Bar_8,
        Bar_7,
        Bar_6,
        Bar_5,
        Total,
        Remain,
        Elapsed,
        Bar_1,
        Bar_2,
        Bar_3,
        Bar_4,

        Bat_6,
        Bat_5,
        Bat_4,
        Bat_3,
        Bat_2,
        Bat_1,
        Bat_0,
        Bpm,
        Auto,
        Usb,
        Sd,
        Cd,
        Lock,
        TempO,
        Key,
        L1,
        _1,
        _2,
        L2,
        L3,
        Point,
        Max
    } Symbols;

    typedef enum
    {
        NONE = -1,
        CLOCKWISE,
        ANTICLOCKWISE,
        UP2DOWN,
        DOWN2UP,
        LEFT2RT,
        RT2LEFT,
        MAX
    } NumAni;

    typedef struct
    {
        char current_content;
        char last_content;
        int animation_step;
        NumAni animation_type;
        bool need_update;
    } ContentData;

#define BUFFER_SIZE 256
#define DISPLAY_SIZE 10

    typedef struct
    {
        char buffer_top[BUFFER_SIZE + 1];    // +1 for null terminator
        char buffer_bottom[BUFFER_SIZE + 1]; // +1 for null terminator
        int start_pos_top;
        int start_pos_bottom;
        int length_top;
        int length_bottom;
    } CircularBuffer;

    FTB_BT_247GN(gpio_num_t din, gpio_num_t clk, gpio_num_t cs, spi_host_device_t spi_num);
    FTB_BT_247GN(spi_device_handle_t spi_device);
    void test();
    void setbrightness(uint8_t brightness);
    void setsleep(bool en);
    void noti_show(int start, const char *buf, int size, bool forceupdate = false, NumAni ani = LEFT2RT, int timeout = 2000);
    void pixel_show(int y, const char *str);
    void spectrum_show(float *buf, int size);
    void num_show(int start, const char *buf, int size, bool forceupdate = false, NumAni ani = ANTICLOCKWISE);
    void pixelhelper(int index, uint8_t *code);
    void numhelper(int index, uint8_t code);
    void symbolhelper(Symbols icon, bool en);
    void time_blink();
    void set_fonttype(int index);

private:
#if USE_MUTI_FONTS
    const uint8_t (*const hex_codes_map[6])[5] = {hex_codes_style1, hex_codes_style2, hex_codes_style3,
                                                  hex_codes_style4, hex_codes_style5, hex_codes_style6};
    const uint8_t (*hex_codes)[5] = hex_codes_map[0];
#else
    const uint8_t (*hex_codes)[5] = hex_codes_style1;
#endif
    uint8_t dimming = 0;
    spi_device_handle_t spi_device_;
    int64_t content_inhibit_time = 0;
    ContentData currentPixelData[PIXEL_COUNT] = {0};
    ContentData tempPixelData[PIXEL_COUNT] = {0};
    ContentData currentNumData[NUM_COUNT] = {0};
    uint8_t pixel_gram[5 * PIXEL_COUNT] = {0};
    uint8_t num_gram[NUM_COUNT] = {0};
    uint8_t icon_gram[ICON_COUNT] = {0};
    CircularBuffer *cb = new CircularBuffer();

    void init_task();
    void pixelanimate();
    void numberanimate();
    void refrash();
    void display_buffer();
    void scroll_buffer();

    uint8_t contentgetpart(uint8_t raw, uint8_t before_raw, uint8_t mask);
    void write_data8(uint8_t *dat, int len);
    const uint8_t *find_pixel_hex_code(char ch);
    uint8_t find_num_hex_code(char ch);

protected:
    void pixel_write(int x, int y, const uint8_t *code, int len);
    void pixel_write(int x, int y, const char *ascii, int len);
    void num_write(int x, const uint8_t *code, int len);
    void num_write(int x, const char *ascii, int len);
    void icon_write(Symbols icon, bool en);
    void icon_write(int x, const uint8_t *code, int len);
    void dimming_write(int val);
    void pixel_show(int start, const char *buf, int size, bool forceupdate = false, NumAni ani = LEFT2RT);
};

#endif